home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / Balloons.h < prev    next >
Text File  |  1991-04-17  |  10KB  |  222 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 27, 1991 at 8:21 PM
  4.     Balloons.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc. 1990
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __BALLOONS__
  15. #define __BALLOONS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24.  
  25. #ifndef __MENUS__
  26. #include <Menus.h>
  27. #endif
  28.  
  29. #ifndef __TRAPS__
  30. #include <Traps.h>
  31. #endif
  32.  
  33.  
  34. enum {
  35.  
  36.     hmBalloonHelpVersion = 0x0002,      /* The real version of the Help Manager */
  37.  
  38. /*Help Mgr error range: -850 to -874*/
  39.     hmHelpDisabled = -850,              /* Show Balloons mode was off, call to routine ignored */
  40.     hmBalloonAborted = -853,            /* Returned if mouse was moving or mouse wasn't in window port rect */
  41.     hmSameAsLastBalloon = -854,         /* Returned from HMShowMenuBalloon if menu & item is same as last time */
  42.     hmHelpManagerNotInited = -855,      /* Returned from HMGetHelpMenuHandle if help menu not setup */
  43.     hmSkippedBalloon = -857,            /* Returned from calls if helpmsg specified a skip balloon */
  44.     hmWrongVersion = -858,              /* Returned if help mgr resource was the wrong version */
  45.     hmUnknownHelpType = -859,           /* Returned if help msg record contained a bad type */
  46.     hmOperationUnsupported = -861,      /* Returned from HMShowBalloon call if bad method passed to routine */
  47.     hmNoBalloonUp = -862,               /* Returned from HMRemoveBalloon if no balloon was visible when call was made */
  48.     hmCloseViewActive = -863,           /* Returned from HMRemoveBalloon if CloseView was active */
  49.     kHMHelpMenuID = -16490,             /* Resource ID and menu ID of help menu */
  50.     kHMAboutHelpItem = 1,               /* help menu item number of About Balloon Help… */
  51.     kHMShowBalloonsItem = 3,            /* help menu item number of Show/Hide Balloons */
  52.     kHMHelpID = -5696,                  /* ID of various Help Mgr package resources (in Pack14 range) */
  53.     kBalloonWDEFID = 126,               /* Resource ID of the WDEF proc used in standard balloons */
  54.  
  55. /*Dialog item template type*/
  56.     helpItem = 1,                       /* key value in DITL template that corresponds to the help item */
  57.  
  58. /* Options for Help Manager resources in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  59.     hmDefaultOptions = 0,               /* default options for help manager resources */
  60.     hmUseSubID = 1,                     /* treat resID's in resources as subID's of driver base ID */
  61.     hmAbsoluteCoords = 2                /* ignore window port origin and treat rectangles as absolute coords */
  62. };
  63. enum {
  64.     hmSaveBitsNoWindow = 4,             /* don't create a window, just blast bits on screen. No update event is generated */
  65.     hmSaveBitsWindow = 8,               /* create a window, but restore bits behind window when window goes away */
  66.     hmMatchInTitle = 16,                /* for hwin resources, match string anywhere in window title string */
  67.  
  68. /* Constants for Help Types in 'hmnu', 'hdlg', 'hrct', 'hovr', & 'hfdr' resources */
  69.     kHMStringItem = 1,                  /* pstring used in resource */
  70.     kHMPictItem = 2,                    /* 'PICT' ResID used in resource */
  71.     kHMStringResItem = 3,               /* 'STR#' ResID & index used in resource */
  72.     kHMTEResItem = 6,                   /* Styled Text Edit ResID used in resource ('TEXT' & 'styl') */
  73.     kHMSTRResItem = 7,                  /* 'STR ' ResID used in resource */
  74.     kHMSkipItem = 256,                  /* don't display a balloon */
  75.     kHMCompareItem = 512,               /* Compare pstring in menu item w/ PString in resource item */
  76.     kHMNamedResourceItem = 1024,        /* Use pstring in menu item to get 'STR#', 'PICT', or 'STR ' resource ('hmnu' only) */
  77.     kHMTrackCntlItem = 2048,            /* Reserved */
  78.  
  79. /* Constants for hmmHelpType's when filling out HMMessageRecord */
  80.     khmmString = 1,                     /* help message contains a PString */
  81.     khmmPict = 2,                       /* help message contains a resource ID to a 'PICT' resource */
  82.     khmmStringRes = 3,                  /* help message contains a res ID & index to a 'STR#' resource */
  83.     khmmTEHandle = 4,                   /* help message contains a Text Edit handle */
  84.     khmmPictHandle = 5,                 /* help message contains a Picture handle */
  85.     khmmTERes = 6,                      /* help message contains a res ID to 'TEXT' & 'styl' resources */
  86.     khmmSTRRes = 7,                     /* help message contains a res ID to a 'STR ' resource */
  87.  
  88. #define kHMTETextResType 'TEXT'         /* Resource Type of text data for styled TE record w/o style info */
  89. #define kHMTEStyleResType 'styl'        /* Resource Type of style information for styled TE record */
  90.  
  91. /*Generic defines for the switch items used in 'hmnu' & 'hdlg'*/
  92.  
  93.     kHMEnabledItem = 0                  /* item is enabled, but not checked or control value = 0 */
  94. };
  95. enum {
  96.     kHMDisabledItem = 1,                /* item is disabled, grayed in menus or disabled in dialogs */
  97.     kHMCheckedItem = 2,                 /* item is enabled, and checked or control value = 1 */
  98.     kHMOtherItem = 3,                   /* item is enabled, and control value > 1 */
  99.  
  100. /* Resource Types for whichType parameter used when extracting 'hmnu' & 'hdlg' messages */
  101.  
  102. #define kHMMenuResType 'hmnu'           /* ResType of help resource for supporting menus */
  103. #define kHMDialogResType 'hdlg'         /* ResType of help resource for supporting dialogs */
  104. #define kHMWindListResType 'hwin'       /* ResType of help resource for supporting windows */
  105. #define kHMRectListResType 'hrct'       /* ResType of help resource for rectangles in windows */
  106. #define kHMOverrideResType 'hovr'       /* ResType of help resource for overriding system balloons */
  107. #define kHMFinderApplResType 'hfdr'     /* ResType of help resource for custom balloon in Finder */
  108.  
  109. /* constants to pass to method parameter in HMShowBalloon */
  110.  
  111.     kHMRegularWindow = 0,               /* Create a regular window floating above all windows */
  112.     kHMSaveBitsNoWindow = 1,            /* Just save the bits and draw (for MDEF calls) */
  113.     kHMSaveBitsWindow = 2               /* Regular window, save bits behind, AND generate update event */
  114. };
  115.  
  116. struct HMStringResType {
  117.     short hmmResID;
  118.     short hmmIndex;
  119. };
  120.  
  121. typedef struct HMStringResType HMStringResType;
  122.  
  123. struct HMMessageRecord {
  124.         short        hmmHelpType;
  125.         union {
  126.                     char                hmmString[256];
  127.                     short                hmmPict;
  128.                     Handle                hmmTEHandle;
  129.                     HMStringResType        hmmStringRes;
  130.                     short                hmmPictRes;
  131.                     Handle                hmmPictHandle;
  132.                     short                hmmTERes;
  133.                     short                hmmSTRRes;
  134.                 } u;
  135. };
  136.  
  137. typedef struct HMMessageRecord HMMessageRecord;
  138. typedef HMMessageRecord *HMMessageRecPtr;
  139.  
  140.  
  141. #ifdef __cplusplus
  142. extern "C" {
  143. #endif
  144. /*  Public Interfaces  */
  145. pascal OSErr HMGetHelpMenuHandle(MenuHandle *mh)
  146.     = {0x303C,0x0200,_Pack14}; 
  147. pascal OSErr HMShowBalloon(const HMMessageRecord *aHelpMsg,
  148.                            Point tip,
  149.                            RectPtr alternateRect,
  150.                            Ptr tipProc,
  151.                            short theProc,
  152.                            short variant,
  153.                            short method)
  154.     = {0x303C,0x0B01,_Pack14}; 
  155. pascal OSErr HMRemoveBalloon(void)
  156.     = {0x303C,0x0002,_Pack14}; 
  157. pascal Boolean HMGetBalloons(void)
  158.     = {0x303C,0x0003,_Pack14}; 
  159. pascal OSErr HMSetBalloons(Boolean flag)
  160.     = {0x303C,0x0104,_Pack14}; 
  161. pascal OSErr HMShowMenuBalloon(short itemNum,
  162.                                short itemMenuID,
  163.                                long itemFlags,
  164.                                long itemReserved,
  165.                                Point tip,
  166.                                RectPtr alternateRect,
  167.                                Ptr tipProc,
  168.                                short theProc,
  169.                                short variant)
  170.     = {0x303C,0x0E05,_Pack14}; 
  171. pascal OSErr HMGetIndHelpMsg(ResType whichType,
  172.                              short whichResID,
  173.                              short whichMsg,
  174.                              short whichState,
  175.                              long *options,
  176.                              Point *tip,
  177.                              Rect *altRect,
  178.                              short *theProc,
  179.                              short *variant,
  180.                              HMMessageRecord *aHelpMsg,
  181.                              short *count)
  182.     = {0x303C,0x1306,_Pack14}; 
  183. pascal Boolean HMIsBalloon(void)
  184.     = {0x303C,0x0007,_Pack14}; 
  185. pascal OSErr HMSetFont(short font)
  186.     = {0x303C,0x0108,_Pack14}; 
  187. pascal OSErr HMSetFontSize(short fontSize)
  188.     = {0x303C,0x0109,_Pack14}; 
  189. pascal OSErr HMGetFont(short *font)
  190.     = {0x303C,0x020A,_Pack14}; 
  191. pascal OSErr HMGetFontSize(short *fontSize)
  192.     = {0x303C,0x020B,_Pack14}; 
  193. pascal OSErr HMSetDialogResID(short resID)
  194.     = {0x303C,0x010C,_Pack14}; 
  195. pascal OSErr HMSetMenuResID(short menuID,
  196.                             short resID)
  197.     = {0x303C,0x020D,_Pack14}; 
  198. pascal OSErr HMBalloonRect(const HMMessageRecord *aHelpMsg,
  199.                            Rect *coolRect)
  200.     = {0x303C,0x040E,_Pack14}; 
  201. pascal OSErr HMBalloonPict(const HMMessageRecord *aHelpMsg,
  202.                            PicHandle *coolPict)
  203.     = {0x303C,0x040F,_Pack14}; 
  204. pascal OSErr HMScanTemplateItems(short whichID,
  205.                                  short whichResFile,
  206.                                  ResType whichType)
  207.     = {0x303C,0x0410,_Pack14}; 
  208. pascal OSErr HMExtractHelpMsg(ResType whichType,short whichResID,short whichMsg,
  209.     short whichState,HMMessageRecord *aHelpMsg)
  210.     = {0x303C,0x0711,_Pack14}; 
  211. pascal OSErr HMGetDialogResID(short *resID)
  212.     = {0x303C,0x0213,_Pack14}; 
  213. pascal OSErr HMGetMenuResID(short menuID,short *resID)
  214.     = {0x303C,0x0314,_Pack14}; 
  215. pascal OSErr HMGetBalloonWindow(WindowPtr *window)
  216.     = {0x303C,0x0215,_Pack14}; 
  217. #ifdef __cplusplus
  218. }
  219. #endif
  220.  
  221. #endif
  222.